package com.example.selfservicestation.widget

import android.content.Context
import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.example.selfservicestation.extensions.toPx

class MyItemDecoration(private val context: Context, private val columnCount: Int): RecyclerView.ItemDecoration() {
    override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
        val position = parent.getChildAdapterPosition(view)
        if (position % columnCount == 0){
            return
        }
        outRect.left = context.toPx(20).toInt()
    }
}